package cn.kawa.basic.util;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 *
 */
@Data
//@AllArgsConstructor
//@NoArgsConstructor
public class JsonResult {
    private Boolean success =true;
    private String msg = "操作成功";

    //传参容器
    private Object resultObj;

    /**
     * 返回一个对象,
     */
    public static JsonResult me(){
        return new JsonResult();
    }

    /**
     *
     * @param msg
     * @return set 失败信息,调用此方法可以更改赋值JsonResult并返回
     */
    public JsonResult setMsg(String msg) {
        this.msg = msg;
        this.success=false;
        return this;
    }
    public JsonResult setResultObj(Object resultObj) {
        this.resultObj = resultObj;
        return this;
    }

    public JsonResult setSuccess(Boolean success) {
        this.success = success;
        return this;
    }
}
